/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package simplepushserver.filesend;

/**
 *
 * @author Fille
 */
public class Time {
    private long hour=0;
    private long minute=0;
    private long second=0;

    public Time(int hh,int mm, int ss){
        this.hour=hh;
        this.minute=mm;
        this.second=ss;
    }
    public Time() {    }

    public void setTime(long sec){
        hour=0;
        minute=0;
        second=sec;
        redistributeUnits();
    }
    public void redistributeUnits(){
        while(minute>59 || second>59){
            if(second>59){
                second-=60;
                minute++;
            }
            if(minute>59){
                minute-=60;
                hour++;
            }
        }
    }

    public long getHour() {
        return hour;
    }
    public void setHour(long hour) {
        this.hour = hour;
    }
    public long getMinute() {
        return minute;
    }
    public void setMinute(long minute) {
        this.minute = minute;
    }
    public long getSecond() {
        return second;
    }
    public void setSecond(long second) {
        this.second = second;
    }

    public String toString(){
        String mmS=""+minute;
        String ssS=""+second;
        if(minute<10)
            mmS="0"+minute;
        if(second<10)
            ssS="0"+second;
        return hour+"h "+mmS+"m "+ssS+"s";
    }
}
